package no.rmz.chez.chess.board;

/**
 * Represent the possible colors of a chesspiece.
 */
public enum Color {
    /**
     * The color of a black chesspiece.
     */
    BLACK,

    /**
     * The color of a white chesspiece.
     */
    WHITE;

    /**
     * Given the color of a chesspiece, what is the
     * color of the oposition's pieces?
     * @param c Color of a chesspiece
     * @return the color of the oposition's  piece
     */
    public static  Color oposingColor(final Color c) {
        if (c == BLACK) {
            return WHITE;
        } else if (c == WHITE) {
            return BLACK;
        } else {
            throw new RuntimeException("Unknown color " + c);
        }
    }

    public int colsign(final Color color) {
       if (color == this) {
           return 1;
       }  else {
           return -1;
       }
    }
}
